﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.OleDb;

public partial class DodajNaracka : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        string conString = ConfigurationManager.ConnectionStrings["MyConn"].ConnectionString;
        OleDbConnection conn = new OleDbConnection(conString);
        conn.Open();
        string insert = "insert into Poracki (Kolicina,Tip_na_naracka,Cena) values (?,?,?)";
        OleDbCommand cmd = new OleDbCommand(insert, conn);
        string Kolicina = TextBox1.Text.ToString();
        string Tip = TextBox2.Text.ToString();
        string Cena = TextBox3.Text.ToString();
        cmd.Parameters.AddWithValue("?", Kolicina);
        cmd.Parameters.AddWithValue("?", Tip);
        cmd.Parameters.AddWithValue("?", Cena);
        
        cmd.ExecuteNonQuery();
        conn.Close();

        Response.Redirect("Naracki.aspx");
    }
}